#include <bits/stdc++.h>
using namespace std;

void solve(){
    int n;
    cin >> n;
    vector<int> a(n), pre(n + 1);
    int sum = 0;
    int ans = INT_MAX;
    for(int i = 0; i < n; i++) cin >> a[i], pre[i + 1] = pre[i] + a[i];
    for(int i = 1; i <= n; i++) {
        int t= pre[i], f = 0;;
        int x = i, p = i;
        for(int j = i + 1; j <= n; j++) {
            if(pre[j] - pre[p] == t) {
                x = max(x, j - p);
                p = j;
            } else if(pre[j] - pre[p] > t || j == n){
                f = 1;
                break;
            }
        }
        if(f == 0) ans = min(ans, x);
    }
    cout << ans << endl;

}

int main() {
    int t;
    cin >> t;
    while(t--) solve();
    return 0;
}